Component({
    properties: {
        visible: {
            type: Boolean
        },
        list: {
            type: Array
        }
    },
    data: {},
    methods: {
        clearHandler(){
          wx.showModal({
              content:'确定删除所有物品吗?',
              success: res => {
                  if (res.cancel) return
                  this.triggerEvent('clear',true)
              }
          })
        },
        decrement(ev) {
            this.triggerEvent('change', {
                type:"decrement",
                id: ev.currentTarget.dataset.id
            })
        },
        increment(ev) {
            this.triggerEvent('change', {
                type:"increment",
                id: ev.currentTarget.dataset.id
            })
        },
        onClose() {
            this.triggerEvent('close', false)
        }
    }
});
